#pragma once

#include <string>
#include <sstream>
using std::string;
using std::wstring;
using std::wostringstream;

namespace Utilities
{
    int StringToInt(const string& text, int& number);
    
    template <typename num>
    int WstringToNumber(const wstring& text, num& number)
    {
        if ((wistringstream(text) >> number).fail()) {
            return 1;
        }
        else {
            return 0;
        }
    }

    template <typename num>
    int NumberToWstring(const num& number, wstring& text)
    {
        wostringstream wstream;
        wstream << number;
        if (wstream.fail()) {
            text = L"";
            return 1;
        }
        else {
            text = wstream.str();
            return 0;
        }
    }
}

